<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html >
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'listCarteAdvertisements.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="res/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" type="text/css" href="res/css/style.css">
    <script type="text/javascript" src="res/js/jquery-1.9.1.min.js"></script>

  </head>
  
  <body>
    
    <%@include file="../template/header.jsp" %>
    
    <div class="subHead">
        <div class="container">
            <h1>广告商管理后台</h1>
            <p class="lead">广告商可以在此投放广告、查看广告展现情况等。</p>
        </div>
    </div>
    
    <div class="row mainContent">
        
        <%@include file="../template/advertisementNav.jsp" %>
        
        <div class="span9">
            <legend class="text-warning">点单界面广告</legend>
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>#</th>
                    <th>名称</th>
                    <th>出价</th>
                    <th>状态</th>
                    <th>已展现次数</th>
                    <th>期望展现次数</th>
                    <th>投放时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                	<s:iterator value="#request.mainScreenAdvertisements " id="advertisement" status="statu">
                		<tr>
			                <td><s:property value="#statu.index + 1" /></td>
			                <td><s:property value="#advertisement.title" /></td>
			                <td><s:property value="#advertisement.bid" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<span class="badge badge-info">投放中...</span>
			                	</s:if>
			                	<s:elseif test="#advertisement.state == 1">
			                		<span class="badge badge-warning">审批中...</span>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 2">
			                		<span class="badge badge-important">余额不足</span>
			                	</s:elseif>
			                	<s:elseif test="#advertisement.state == 3">
			                		<span class="badge badge-success">展现完成</span>
			                	</s:elseif>
			                	<s:else>
			                		放弃投放
			                	</s:else>
			                </td>
			                <td><s:property value="#advertisement.realityShowNum" /></td>
			                <td><s:property value="#advertisement.expectShowNum" /></td>
			                <td><s:property value="#advertisement.publishDate" /></td>
			                <td>
			                	<s:if test="#advertisement.state == 0">
			                		<a class="btn btn-small btn-warning"
			                			href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=0">放弃投放</a>
			                	</s:if>
			                	<s:else>
			                	
			                		<s:if test="#advertisement.state == 1">
			                			<a class="btn btn-small btn-warning"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=1">放弃投放</a>
			                		</s:if>
			                		<s:elseif test="#advertisement.state == 2">
			                			<a class="btn btn-small btn-info"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=2">恢复投放</a>
			                		</s:elseif>
			                		<s:elseif test="#advertisement.state == 3">
			                			<a class="btn btn-small btn-success"
			                				href="advertisement/undercarriageAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />&state=3">继续展现</a>
			                		</s:elseif>
			                		
			                	</s:else>
			                	
			                	&nbsp;&nbsp;
			                	<a name="edit" title="编辑" onclick="openEidtDialog()" href="#"><i class="icon-pencil"></i></a>
			                	&nbsp;&nbsp;
			                	<a name="delete" title="删除"
			                		href="advertisement/deleteAdvertisement.htm?advertisementId=<s:property value='#advertisement.id' />"><i class="icon-trash"></i></a>
			                </td>
			            </tr>
                	</s:iterator>
                </tbody>
                <tfoot>
                	<tr>
                		<td colspan="8">
                			<div class="pagination">
							  <ul>
							    <li><a href="#">Prev</a></li>
							    <li><a href="#">1</a></li>
							    <li><a href="#">2</a></li>
							    <li><a href="#">3</a></li>
							    <li><a href="#">4</a></li>
							    <li><a href="#">5</a></li>
							    <li><a href="#">Next</a></li>
							  </ul>
							</div>
                		</td>
                	</tr>
                </tfoot>
            </table>
        </div>
    </div>

    <div class="footer">
        <p>版权所有： 银盒子计划团队</p>
    </div>

    <script type="text/javascript" src="res/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $('a[name=delete]').each(function(){
            var that = $(this);
            that.on('click', function(){
                if(confirm('确定删除此商品？')){
                    return;
                }
                else {
                    return false;
                }
            });
        });
        
        
        $("li[name=advertisementNav]").each(function(){
        	var that = $(this);
        	that.removeClass("active");
        });
        
        $("#advertisementNav1").addClass("active");
    </script>
    
  </body>
</html>
